Integrand size = 19, antiderivative size = 271 \[ \int \frac {\csc ^2(x)}{a+b \sin (x)+c \sin ^2(x)} \, dx=\frac {\sqrt {2} b c \left (1+\frac {b^2-2 a c}{b \sqrt {b^2-4 a c}}\right ) \arctan \left (\frac {2 c+\left (b-\sqrt {b^2-4 a c}\right ) \tan \left (\frac {x}{2}\right )}{\sqrt {2} \sqrt {b^2-2 c (a+c)-b \sqrt {b^2-4 a c}}}\right )}{a^2 \sqrt {b^2-2 c (a+c)-b \sqrt {b^2-4 a c}}}+\frac {\sqrt {2} b c \left (1-\frac {b^2-2 a c}{b \sqrt {b^2-4 a c}}\right ) \arctan \left (\frac {2 c+\left (b+\sqrt {b^2-4 a c}\right ) \tan \left (\frac {x}{2}\right )}{\sqrt {2} \sqrt {b^2-2 c (a+c)+b \sqrt {b^2-4 a c}}}\right )}{a^2 \sqrt {b^2-2 c (a+c)+b \sqrt {b^2-4 a c}}}+\frac {b \text {arctanh}(\cos (x))}{a^2}-\frac {\cot (x)}{a} \]
b*arctanh(cos(x))/a^2-cot(x)/a+b*c*arctan(1/2*(2*c+(b-(-4*a*c+b^2)^(1/2))* tan(1/2*x))*2^(1/2)/(b^2-2*c*(a+c)-b*(-4*a*c+b^2)^(1/2))^(1/2))*2^(1/2)*(1 +(-2*a*c+b^2)/b/(-4*a*c+b^2)^(1/2))/a^2/(b^2-2*c*(a+c)-b*(-4*a*c+b^2)^(1/2 ))^(1/2)+b*c*arctan(1/2*(2*c+(b+(-4*a*c+b^2)^(1/2))*tan(1/2*x))*2^(1/2)/(b ^2-2*c*(a+c)+b*(-4*a*c+b^2)^(1/2))^(1/2))*2^(1/2)*(1+(2*a*c-b^2)/b/(-4*a*c +b^2)^(1/2))/a^2/(b^2-2*c*(a+c)+b*(-4*a*c+b^2)^(1/2))^(1/2)
Result contains complex when optimal does not.
Time = 2.52 (sec) , antiderivative size = 388, normalized size of antiderivative = 1.43 \[ \int \frac {\csc ^2(x)}{a+b \sin (x)+c \sin ^2(x)} \, dx=\frac {\csc ^2(x) (-2 a-c+c \cos (2 x)-2 b \sin (x)) \left (-\frac {2 c \left (-i b^2+2 i a c+b \sqrt {-b^2+4 a c}\right ) \arctan \left (\frac {2 c+\left (b-i \sqrt {-b^2+4 a c}\right ) \tan \left (\frac {x}{2}\right )}{\sqrt {2} \sqrt {b^2-2 c (a+c)-i b \sqrt {-b^2+4 a c}}}\right )}{\sqrt {-\frac {b^2}{2}+2 a c} \sqrt {b^2-2 c (a+c)-i b \sqrt {-b^2+4 a c}}}+\frac {2 i c \left (-b^2+2 a c+i b \sqrt {-b^2+4 a c}\right ) \arctan \left (\frac {2 c+\left (b+i \sqrt {-b^2+4 a c}\right ) \tan \left (\frac {x}{2}\right )}{\sqrt {2} \sqrt {b^2-2 c (a+c)+i b \sqrt {-b^2+4 a c}}}\right )}{\sqrt {-\frac {b^2}{2}+2 a c} \sqrt {b^2-2 c (a+c)+i b \sqrt {-b^2+4 a c}}}+a \cot \left (\frac {x}{2}\right )-2 b \log \left (\cos \left (\frac {x}{2}\right )\right )+2 b \log \left (\sin \left (\frac {x}{2}\right )\right )-a \tan \left (\frac {x}{2}\right )\right )}{4 a^2 \left (c+b \csc (x)+a \csc ^2(x)\right )} \]
(Csc[x]^2*(-2*a - c + c*Cos[2*x] - 2*b*Sin[x])*((-2*c*((-I)*b^2 + (2*I)*a* c + b*Sqrt[-b^2 + 4*a*c])*ArcTan[(2*c + (b - I*Sqrt[-b^2 + 4*a*c])*Tan[x/2 ])/(Sqrt[2]*Sqrt[b^2 - 2*c*(a + c) - I*b*Sqrt[-b^2 + 4*a*c]])])/(Sqrt[-1/2 *b^2 + 2*a*c]*Sqrt[b^2 - 2*c*(a + c) - I*b*Sqrt[-b^2 + 4*a*c]]) + ((2*I)*c *(-b^2 + 2*a*c + I*b*Sqrt[-b^2 + 4*a*c])*ArcTan[(2*c + (b + I*Sqrt[-b^2 + 4*a*c])*Tan[x/2])/(Sqrt[2]*Sqrt[b^2 - 2*c*(a + c) + I*b*Sqrt[-b^2 + 4*a*c] ])])/(Sqrt[-1/2*b^2 + 2*a*c]*Sqrt[b^2 - 2*c*(a + c) + I*b*Sqrt[-b^2 + 4*a* c]]) + a*Cot[x/2] - 2*b*Log[Cos[x/2]] + 2*b*Log[Sin[x/2]] - a*Tan[x/2]))/( 4*a^2*(c + b*Csc[x] + a*Csc[x]^2))
Time = 0.96 (sec) , antiderivative size = 271, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.158, Rules used = {3042, 3737, 2009}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \frac {\csc ^2(x)}{a+b \sin (x)+c \sin ^2(x)} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {1}{\sin (x)^2 \left (a+b \sin (x)+c \sin (x)^2\right )}dx\) |
\(\Big \downarrow \) 3737 |
\(\displaystyle \int \left (\frac {b^2 \left (1-\frac {a c}{b^2}\right )+b c \sin (x)}{a^2 \left (a+b \sin (x)+c \sin ^2(x)\right )}-\frac {b \csc (x)}{a^2}+\frac {\csc ^2(x)}{a}\right )dx\) |
\(\Big \downarrow \) 2009 |
\(\displaystyle \frac {\sqrt {2} b c \left (\frac {b^2-2 a c}{b \sqrt {b^2-4 a c}}+1\right ) \arctan \left (\frac {\tan \left (\frac {x}{2}\right ) \left (b-\sqrt {b^2-4 a c}\right )+2 c}{\sqrt {2} \sqrt {-b \sqrt {b^2-4 a c}-2 c (a+c)+b^2}}\right )}{a^2 \sqrt {-b \sqrt {b^2-4 a c}-2 c (a+c)+b^2}}+\frac {\sqrt {2} b c \left (1-\frac {b^2-2 a c}{b \sqrt {b^2-4 a c}}\right ) \arctan \left (\frac {\tan \left (\frac {x}{2}\right ) \left (\sqrt {b^2-4 a c}+b\right )+2 c}{\sqrt {2} \sqrt {b \sqrt {b^2-4 a c}-2 c (a+c)+b^2}}\right )}{a^2 \sqrt {b \sqrt {b^2-4 a c}-2 c (a+c)+b^2}}+\frac {b \text {arctanh}(\cos (x))}{a^2}-\frac {\cot (x)}{a}\) |
(Sqrt[2]*b*c*(1 + (b^2 - 2*a*c)/(b*Sqrt[b^2 - 4*a*c]))*ArcTan[(2*c + (b - Sqrt[b^2 - 4*a*c])*Tan[x/2])/(Sqrt[2]*Sqrt[b^2 - 2*c*(a + c) - b*Sqrt[b^2 - 4*a*c]])])/(a^2*Sqrt[b^2 - 2*c*(a + c) - b*Sqrt[b^2 - 4*a*c]]) + (Sqrt[2 ]*b*c*(1 - (b^2 - 2*a*c)/(b*Sqrt[b^2 - 4*a*c]))*ArcTan[(2*c + (b + Sqrt[b^ 2 - 4*a*c])*Tan[x/2])/(Sqrt[2]*Sqrt[b^2 - 2*c*(a + c) + b*Sqrt[b^2 - 4*a*c ]])])/(a^2*Sqrt[b^2 - 2*c*(a + c) + b*Sqrt[b^2 - 4*a*c]]) + (b*ArcTanh[Cos [x]])/a^2 - Cot[x]/a
3.1.7.3.1 Defintions of rubi rules used
Int[sin[(d_.) + (e_.)*(x_)]^(m_.)*((a_.) + (b_.)*sin[(d_.) + (e_.)*(x_)]^(n _.) + (c_.)*sin[(d_.) + (e_.)*(x_)]^(n2_.))^(p_), x_Symbol] :> Int[ExpandTr ig[sin[d + e*x]^m*(a + b*sin[d + e*x]^n + c*sin[d + e*x]^(2*n))^p, x], x] / ; FreeQ[{a, b, c, d, e}, x] && EqQ[n2, 2*n] && NeQ[b^2 - 4*a*c, 0] && Integ ersQ[m, n, p]
Time = 2.83 (sec) , antiderivative size = 337, normalized size of antiderivative = 1.24
method | result | size |
default | \(\frac {\tan \left (\frac {x}{2}\right )}{2 a}+\frac {\frac {2 \left (3 \sqrt {-4 a c +b^{2}}\, a b c -\sqrt {-4 a c +b^{2}}\, b^{3}-4 a^{2} c^{2}+5 a \,b^{2} c -b^{4}\right ) \arctan \left (\frac {2 a \tan \left (\frac {x}{2}\right )+b +\sqrt {-4 a c +b^{2}}}{\sqrt {4 a c -2 b^{2}-2 b \sqrt {-4 a c +b^{2}}+4 a^{2}}}\right )}{a \left (4 a c -b^{2}\right ) \sqrt {4 a c -2 b^{2}-2 b \sqrt {-4 a c +b^{2}}+4 a^{2}}}-\frac {2 \left (-3 \sqrt {-4 a c +b^{2}}\, a b c +\sqrt {-4 a c +b^{2}}\, b^{3}-4 a^{2} c^{2}+5 a \,b^{2} c -b^{4}\right ) \arctan \left (\frac {-2 a \tan \left (\frac {x}{2}\right )+\sqrt {-4 a c +b^{2}}-b}{\sqrt {4 a c -2 b^{2}+2 b \sqrt {-4 a c +b^{2}}+4 a^{2}}}\right )}{a \left (4 a c -b^{2}\right ) \sqrt {4 a c -2 b^{2}+2 b \sqrt {-4 a c +b^{2}}+4 a^{2}}}}{a}-\frac {1}{2 a \tan \left (\frac {x}{2}\right )}-\frac {b \ln \left (\tan \left (\frac {x}{2}\right )\right )}{a^{2}}\) | \(337\) |
risch | \(\text {Expression too large to display}\) | \(2623\) |
1/2*tan(1/2*x)/a+2/a*((3*(-4*a*c+b^2)^(1/2)*a*b*c-(-4*a*c+b^2)^(1/2)*b^3-4 *a^2*c^2+5*a*b^2*c-b^4)/a/(4*a*c-b^2)/(4*a*c-2*b^2-2*b*(-4*a*c+b^2)^(1/2)+ 4*a^2)^(1/2)*arctan((2*a*tan(1/2*x)+b+(-4*a*c+b^2)^(1/2))/(4*a*c-2*b^2-2*b *(-4*a*c+b^2)^(1/2)+4*a^2)^(1/2))-(-3*(-4*a*c+b^2)^(1/2)*a*b*c+(-4*a*c+b^2 )^(1/2)*b^3-4*a^2*c^2+5*a*b^2*c-b^4)/a/(4*a*c-b^2)/(4*a*c-2*b^2+2*b*(-4*a* c+b^2)^(1/2)+4*a^2)^(1/2)*arctan((-2*a*tan(1/2*x)+(-4*a*c+b^2)^(1/2)-b)/(4 *a*c-2*b^2+2*b*(-4*a*c+b^2)^(1/2)+4*a^2)^(1/2)))-1/2/a/tan(1/2*x)-1/a^2*b* ln(tan(1/2*x))
Leaf count of result is larger than twice the leaf count of optimal. 6851 vs. \(2 (237) = 474\).
Time = 258.46 (sec) , antiderivative size = 6851, normalized size of antiderivative = 25.28 \[ \int \frac {\csc ^2(x)}{a+b \sin (x)+c \sin ^2(x)} \, dx=\text {Too large to display} \]
\[ \int \frac {\csc ^2(x)}{a+b \sin (x)+c \sin ^2(x)} \, dx=\int \frac {\csc ^{2}{\left (x \right )}}{a + b \sin {\left (x \right )} + c \sin ^{2}{\left (x \right )}}\, dx \]
\[ \int \frac {\csc ^2(x)}{a+b \sin (x)+c \sin ^2(x)} \, dx=\int { \frac {\csc \left (x\right )^{2}}{c \sin \left (x\right )^{2} + b \sin \left (x\right ) + a} \,d x } \]
1/2*(2*(a^2*cos(2*x)^2 + a^2*sin(2*x)^2 - 2*a^2*cos(2*x) + a^2)*integrate( 2*(2*b^2*c*cos(3*x)^2 + 2*b^2*c*cos(x)^2 + 2*b^2*c*sin(3*x)^2 + 2*b^2*c*si n(x)^2 + b*c^2*sin(x) + 4*(2*a*b^2 - a*c^2 - (2*a^2 - b^2)*c)*cos(2*x)^2 + 2*(2*b^3 + b*c^2)*cos(x)*sin(2*x) + 4*(2*a*b^2 - a*c^2 - (2*a^2 - b^2)*c) *sin(2*x)^2 - (b*c^2*sin(3*x) - b*c^2*sin(x) + 2*(b^2*c - a*c^2)*cos(2*x)) *cos(4*x) - 2*(2*b^2*c*cos(x) + (2*b^3 + b*c^2)*sin(2*x))*cos(3*x) - 2*(b^ 2*c - a*c^2 + (2*b^3 + b*c^2)*sin(x))*cos(2*x) + (b*c^2*cos(3*x) - b*c^2*c os(x) - 2*(b^2*c - a*c^2)*sin(2*x))*sin(4*x) - (4*b^2*c*sin(x) + b*c^2 - 2 *(2*b^3 + b*c^2)*cos(2*x))*sin(3*x))/(a^2*c^2*cos(4*x)^2 + 4*a^2*b^2*cos(3 *x)^2 + 4*a^2*b^2*cos(x)^2 + a^2*c^2*sin(4*x)^2 + 4*a^2*b^2*sin(3*x)^2 + 4 *a^2*b^2*sin(x)^2 + 4*a^2*b*c*sin(x) + a^2*c^2 + 4*(4*a^4 + 4*a^3*c + a^2* c^2)*cos(2*x)^2 + 8*(2*a^3*b + a^2*b*c)*cos(x)*sin(2*x) + 4*(4*a^4 + 4*a^3 *c + a^2*c^2)*sin(2*x)^2 - 2*(2*a^2*b*c*sin(3*x) - 2*a^2*b*c*sin(x) - a^2* c^2 + 2*(2*a^3*c + a^2*c^2)*cos(2*x))*cos(4*x) - 8*(a^2*b^2*cos(x) + (2*a^ 3*b + a^2*b*c)*sin(2*x))*cos(3*x) - 4*(2*a^3*c + a^2*c^2 + 2*(2*a^3*b + a^ 2*b*c)*sin(x))*cos(2*x) + 4*(a^2*b*c*cos(3*x) - a^2*b*c*cos(x) - (2*a^3*c + a^2*c^2)*sin(2*x))*sin(4*x) - 4*(2*a^2*b^2*sin(x) + a^2*b*c - 2*(2*a^3*b + a^2*b*c)*cos(2*x))*sin(3*x)), x) + (b*cos(2*x)^2 + b*sin(2*x)^2 - 2*b*c os(2*x) + b)*log(cos(x)^2 + sin(x)^2 + 2*cos(x) + 1) - (b*cos(2*x)^2 + b*s in(2*x)^2 - 2*b*cos(2*x) + b)*log(cos(x)^2 + sin(x)^2 - 2*cos(x) + 1) -...
Timed out. \[ \int \frac {\csc ^2(x)}{a+b \sin (x)+c \sin ^2(x)} \, dx=\text {Timed out} \]
Time = 25.09 (sec) , antiderivative size = 16102, normalized size of antiderivative = 59.42 \[ \int \frac {\csc ^2(x)}{a+b \sin (x)+c \sin ^2(x)} \, dx=\text {Too large to display} \]
tan(x/2)/(2*a) - 1/(2*a*tan(x/2)) - atan(((((-(b^8 + 8*a^3*c^5 + 8*a^4*c^4 + b^5*(-(4*a*c - b^2)^3)^(1/2) - b^6*c^2 + 8*a*b^4*c^3 - 18*a^2*b^2*c^4 + 33*a^2*b^4*c^2 - 38*a^3*b^2*c^3 - b^3*c^2*(-(4*a*c - b^2)^3)^(1/2) - 10*a *b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